﻿<Controls:SinacorWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                         xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
                         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         mc:Ignorable="d" 
                         xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls" 
                         WindowStartupLocation="CenterScreen"
                         WindowState="Maximized"
                         Title="{DynamicResource Bovespa.Cliente.Label.CadastroCorrespondentes}"
                         x:Class="Sinacor.UI.Bovespa.Clientes.View.SmartClient.CadastroCorrespondentes"
                         ModulePlus="true"
                         ModuleId="ORD" >

    <Controls:SinacorExpanderContainer>

        <Grid.RowDefinitions>
            <RowDefinition Height="65"/>
            <RowDefinition Height="4"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Controls:SinacorExpander HorizontalAlignment="Stretch"
                                  VerticalAlignment="Top"
                                  Header="{DynamicResource Bovespa.Cliente.Label.Pesquisa}"
                                  AllowExpand="True"
                                  IsExpanded="True"
                                  Grid.Row="0">
            <Grid>
                <Controls:SinacorLabel HorizontalAlignment="Left"
                                       Content="{DynamicResource Bovespa.Cliente.Label.Codigo}"
                                       Width="65"/>
                <Controls:SinacorInt32TextBox VerticalAlignment="Top"
                                         Margin="69,0,0,0"
                                         Integers="7"                                                   
                                         Width="89"
                                         IsFormated="False"
                                         TabIndex="1"
                                         HorizontalAlignment="Left" Name="txtCodigo" 
                                         Value="{Binding FiltroCorrespondente.Codigo, UpdateSourceTrigger=PropertyChanged}" />
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Cliente.Label.Nome}"
                                       Width="60"
                                       Margin="162,0,0,0"
                                       HorizontalAlignment="Left"/>
                <Controls:SinacorTextBox VerticalAlignment="Top"
                                         Margin="226,0,0,0"
                                         Width="623"
                                         MaxLength="60"
                                         ToolTip="{DynamicResource Bovespa.Cliente.Tooltip.FiltroPesquisaCorrespNomeFiltro}"
                                         TabIndex="2"
                                         HorizontalAlignment="Left" Name="txtNome" Text="{Binding FiltroCorrespondente.Nome}"/>
                <Controls:SinacorButton Click="buttonPesquisa_Click"    
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        Content="{DynamicResource Bovespa.Cliente.Label.Pesquisar}"
                                        Margin="854,0,0,0"
                                        Name="buttonPesquisa"
                                        Width="85"
                                        TabIndex="3" 
                                        IsDefault="True"/>

                <Controls:SinacorButton HorizontalAlignment="Left" 
                                        Click="buttonNovaPesquisa_Click"
                                        Name="buttonNovaPesquisa"
                                        VerticalAlignment="Top"
                                        Margin="943,0,0,0" 
                                        TabIndex="4" 
                                        IsDefault="False"
                                        Icon="IconButtonNewSearch"/>
            </Grid>
        </Controls:SinacorExpander>
        <Controls:SinacorExpander HorizontalAlignment="Stretch"												
                                  VerticalAlignment="Stretch"												
                                  Header="{DynamicResource Bovespa.Cliente.Label.Correspondentes}"
                                  Grid.Row="2"
                                  IsExpanded="True"
                                  AllowExpand="False"
                                  TabIndex="5">
            <Grid>
                <Controls:SinacorDataGrid 							 		
                                          AllowBeginInsert="True"
                                          Deleting="grdCorrespondentes_Deleting"
                                          AllowBeginUpdate="True"                                             
                                          AllowCancelInsert="True" 		
                                          CancelingInsert="grdCorrespondentes_CancelingInsert"
                                          CancelingUpdate="grdCorrespondentes_CancelingUpdate"
                                          AllowCancelUpdate="True"
                                          AllowDelete="True"
                                          EndingInsert="grdCorrespondentes_EndingInsert"
                                          EndingUpdate="grdCorrespondentes_EndingUpdate"
                                          InsertBegun="grdCorrespondentes_InsertBegun"
                                          UpdateBegun="grdCorrespondentes_UpdateBegun"
                                          AllowEndInsert="True" 							 		
                                          AllowEndUpdate="True" 							 		
                                          AllowSave="True" 							 		
                                          AllowSaveAll="True" 							 		
                                          AllowUndo="True"
                                          AllowUndoAll="True" 							 		
                                          AllowUndoLast="True" 							 		
                                          RowEditMode="AllCells" 							 		
                                          SelectionMode="Single" 		
                                          HorizontalAlignment="Stretch"
                                          Margin="0,0,0,0"
                                          Name="grdCorrespondentes"
                                          ItemsSource="{Binding Correspondentes}">
                    <Controls:SinacorDataGrid.Columns>

                        <Controls:Column Name="Broker"                                                                                                 
                                         AutoAdjustWidthToContent="False"                                                                                                           
                                         Title="Bovespa.Cliente.Label.Broker" 
                                         AllowInsert="True" 
                                         AllowUpdate="True" 
                                         DisplayMemberPath="IndicadorBroker" 
                                         Width="65"                                                                                                           
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorCheckBox x:Name="chkIndicadorBroker" IsChecked="{Binding IndicadorBroker}" />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column Name="Codigo"  				
                                         AutoAdjustWidthToContent="False" 									 				
                                         Title="Bovespa.Cliente.Label.Codigo" 																			
                                         Width="90"                                         
                                         Integers="7"                                         
                                         AllowInsert="True"
                                         Decimals="0"
                                         DisplayMemberPath="Codigo"
                                         HorizontalCellAlignment="Right"
                                         CellUpdateTemplate="{Binding  Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox IsFormated="False" IsRequired="True" Value="{Binding Codigo, UpdateSourceTrigger=PropertyChanged}"  
                                         Integers="7" RequiredErrorMessage="Bovespa.Cliente.ExceptionMessage.CodigoCorrespondenteObrigatorio" LostFocus="SinacorInt32TextBox_LostFocus"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="NomeResumido" 									 				
                                         Title="Bovespa.Cliente.Label.NomeResumido"										
                                         Width="270"
                                         AllowInsert="True"
                                         MaxLength="20"
                                         AllowUpdate="True"
                                         DisplayMemberPath="NomeResumidoCorrespondente"
                                         AutoAdjustWidthToContent="False" 									 				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorTextBox Text="{Binding NomeResumidoCorrespondente}" IsRequired="True"
                                                             MaxLength="20" RequiredErrorMessage="Bovespa.Cliente.ExceptionMessage.NomeResumidoCorrespondenteObrigatorio"  />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="CodigoMembroBovespa" 			
                                         Title="Bovespa.Cliente.Label.CodMembroBolsa"	
                                         Width="135"
                                         Integers="5"
                                         Decimals="50"
                                         AllowUpdate="True"
                                         AllowInsert="True"
                                         DisplayMemberPath="CodigoMembroBovespa"
                                         HorizontalCellAlignment="Right"
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox Value="{Binding CodigoMembroBovespa, UpdateSourceTrigger=PropertyChanged}" Integers="5"  IsFormated="False" IsRequired="True" RequiredErrorMessage="Bovespa.Cliente.ExceptionMessage.CodigoMembroBolsaCorrespondenteObrigatorio"  />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="Devolucao" 																 				
                                         AutoAdjustWidthToContent="False" 									 				
                                         Title="Bovespa.Cliente.Label.Devolucao" 																			
                                         Width="170" 		
                                         Integers="12"
                                         Decimals="8"
                                         AllowInsert="True"
                                         AllowUpdate="True"
                                         StringFormat="N8"                                                                                                                          
                                         DisplayMemberPath="PercentualComissao"
                                         HorizontalCellAlignment="Right"
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox Value="{Binding PercentualComissao, UpdateSourceTrigger=PropertyChanged}"  Decimals="8" IsRequired="True" Integers="4" RequiredErrorMessage="Bovespa.Cliente.ExceptionMessage.PercentualDevolucaoCorrespondenteObrigatorio"   />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="Nome"                                         
                                         AllowUpdate="True"
                                         Title="Bovespa.Cliente.Label.Nome"										
                                         AutoAdjustWidthToContent="True" 
                                         AllowInsert="True"
                                         Integers="60"  
                                         MaxLength="60"
                                         Decimals="0"
                                         DisplayMemberPath="Nome"
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorTextBox Text="{Binding Nome}" IsRequired="True"
                                                             MaxLength="60"
                                         RequiredErrorMessage="Bovespa.Cliente.ExceptionMessage.NomeCorrespondenteObrigatorio"  />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>
